﻿using System;
using DAL;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace BLL
{
    public class StallsBLL
    {
        DigitalWorldDataContext db = new DigitalWorldDataContext();
        /// <summary>
        /// Hàm lấy danh sách gian hàng
        /// </summary>
        /// <returns>Danh sách gian hàng</returns>
        public List<stall> getStalls()
        {
            return db.stalls.ToList();
        }
        /// <summary>
        /// Hàm thêm mới 1 gian hàng
        /// </summary>
        /// <param name="cat">Lớp gian hàng</param>
        public void Stalls_Insert(stall s)
        {
            db.sp_Stall_Insert(s.name, s.description, s.status);
            db.SubmitChanges();
        }
        /// <summary>
        /// Hàm cập nhật 1 gian hàng
        /// </summary>
        /// <param name="cat">Lớp gian hàng</param>
        public void Stalls_Update(stall s)
        {
            db.sp_Stall_Update(s.id, s.name, s.description, s.status);
            db.SubmitChanges();
        }
        /// <summary>
        /// Hàm xoá 1 gian hàng
        /// </summary>
        /// <param name="cat">Lớp gian hàng</param>
        public void Stalls_Delete(int id)
        {
            db.sp_Stall_Delete(id);
            db.SubmitChanges();
        }
    }
}
